package ro.peoplecentric.ctc.common;


/**
 * Creates sql select statement based on table name and where clause.
 * 
 * @author Vitalie Svet
 * @since 20/08/2013
 */
public class TableQueryBuilder {

	private static final String TABLE_PATTERN = "{tablename}";
	private static final String CONDITION_CLAUSE_PATTERN = "{conditionclause}";
	private static final String SELECT_QUERY_PATTERN = "select * from "
			+ TABLE_PATTERN + " "+ CONDITION_CLAUSE_PATTERN;

	public static String buildQuery(String tableName, String whereClause) {
		String query = SELECT_QUERY_PATTERN.replace(TABLE_PATTERN, tableName);
		query = query.replace(CONDITION_CLAUSE_PATTERN, whereClause);
		return query;
	}
}
